import 'package:flutter/material.dart';
import 'package:get/get.dart';

class LanguageUtil {
  // 单例模式
  static final LanguageUtil _instance = LanguageUtil._internal();

  factory LanguageUtil() {
    return _instance;
  }

  LanguageUtil._internal();

  // 获取当前语言
  Locale getCurrentLocale() {
    Locale tmpLocale = Get.locale ?? Localizations.localeOf(Get.context!);

    return tmpLocale;
  }

  // 判断是否为 RTL 语言
  bool isRTL() {
    return getCurrentLocale().languageCode == "ar";
  }
}
